<script>
    var fid = '<%=ret.fid%>';
    var boolOpts = {"0":"否","1":"是"};
    function bool2int(t) {
        return t?1:0;
    }
    var option = {
        url : GURL(handle, 'page?fid='+fid),
        editurl :GURL(handle,'save?fid='+fid),

        colModel : [
            {label: 'id', name: '_id', width: 80,key:true, editable: false,sortable:true, resize:false,search:true,fixed:true},

            {label: '主键', name: 'key',width: 60, editable: true, sortable:false,hidden:false,resize:false,fixed:true,search:false,
                formatter:bool2int, edittype:'select', editoptions:{value:boolOpts},
                stype:"select",
            },

            {label: '字段', name: 'name',width: 180, editable: true, sortable:false,hidden:false,resize:true,fixed:true,search:false},
            {label: '名称', name: 'label',width: 180, editable: true, sortable:false,hidden:false,resize:true,fixed:false,search:false},
            {label: '排序', name: 'sort',width: 60, editable: true, sortable:false,hidden:false,resize:true,fixed:true,search:false},

            {label: 'width', name: 'width',width: 180, editable: true, sortable:false,hidden:false,resize:true,fixed:true,search:false},

            {label: 'editable', name: 'editable',width: 80, editable: true, sortable:false,hidden:false,resize:false,fixed:true,search:false,
                formatter:bool2int, edittype:'select', editoptions:{value:boolOpts},
            },
            {label: 'sortable', name: 'sortable',width: 80, editable: true, sortable:false,hidden:false,resize:false,fixed:true,search:false,
                formatter:bool2int, edittype:'select', editoptions:{value:boolOpts},
            },
            {label: 'resize', name: 'resize',width: 80, editable: true, sortable:false,hidden:false,resize:false,fixed:true,search:false,
                formatter:bool2int, edittype:'select', editoptions:{value:boolOpts},
            },
            {label: 'search', name: 'search',width: 80, editable: true, sortable:false,hidden:false,resize:false,fixed:true,search:false,
                formatter:bool2int, edittype:'select', editoptions:{value:boolOpts},
            },
            {label: 'fixed', name: 'fixed',width: 80, editable: true, sortable:false,hidden:false,resize:false,fixed:true,search:false,
                formatter:bool2int, edittype:'select', editoptions:{value:boolOpts,'defaultValue':'是'},
            },

            {label: 'formatter', name: 'formatter',width: 180, editable: true, sortable:false,hidden:false,resize:false,fixed:true,search:false,},

            {label: '其他', name: 'attr',width: 180, editable: true, sortable:false,hidden:true,resize:true,fixed:true,search:false,
                editrules: { edithidden: true },
                edittype:'textarea',editoptions:{rows:"8",cols:"70"},
                formatter:function (t) {
                    return t ? JSON.stringify(t):"";
                }
            },
        ],
    }

    $(document).ready(function () {
        cosjs_create_jqgrid(option);
    });
</script>